//
//  HWTaskCenterViewController.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/10/8.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWTaskCenterViewController.h"
#import "HWRenwupingluoTableViewCell.h"
#import "HWIntegralMallViewController.h" // 积分商城
#import "HWXingshouRenwuViewController.h" // 新手任务
#import "HWMeiRiRenWuViewController.h"  // 每日任务
#import "HWInviteFriendsViewController.h" //邀请好友
#import "HWDailyCheckController.h"  // 每日签到
#import "HWjifenRenwuTableViewCell.h"
#import "XMGWebViewController.h" // 积分抽奖

#import "HWzuixingdemeirienwuViewController.h" //  最新的每日任务
#import "HWzjuixingshourenwuViewController.h"

#import "HWyaoqinghaoyoujiemianViewController.h"  //

#import "HWNewSignInViewController.h"

#import "HWIntegralMallshopViewController.h"

#import "HWIntegralSubsidiaryViewController.h"

 


 

@interface HWTaskCenterViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) NSArray *dataArr;
@property(strong,nonatomic) NSArray *biaotiArr;
@property(strong,nonatomic) NSArray *icoArr;
@property(strong,nonatomic) UILabel *jifenLabel; //积分Label
@property(strong,nonatomic) NSArray *shujuArr;
@property(strong,nonatomic) UIButton *shuaxingBut;

@property(strong,nonatomic)UILabel *jifenshituLabel; // 最新的积分金额

 


@end

@implementation HWTaskCenterViewController


-(UITableView *)mainaTableVie {

    if (_mainaTableVie == nil
        ) {
        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 138+CF_StatusBarHeight+10, kScreenW,kScreenH-(138+CF_StatusBarHeight+10)) style:UITableViewStylePlain];
         _mainaTableVie.delegate = self;
         _mainaTableVie.dataSource = self;
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        _mainaTableVie.backgroundColor = RGB(247, 247, 247);
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;

    }
    return   _mainaTableVie ;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self shezhichangyongdeshuxiing];
    
    [self setupUI];
    
   
}


- (void)fasongwangluoqing {
    
      
    
       //重制密码
    
        int  r =  [WMUtil getRandomNumber:101 to:998];
      
      
         NSString *uidStr = [NSString stringWithFormat:@"%@",[HWLocallyStoredData getLoginUserID]];
         NSString *tStr = [NSString stringWithFormat:@"%ld%d",[WMUtil getTimeSp],r];
         
      
         
         NSString *singStr = [NSString stringWithFormat:@"%@%@%@",uidStr,tStr,@"fsd213ewdsadqwe2121213edsad"];
         
         NSString *singMD5 = [WMUtil md5HexDigest:singStr];

    
         NSDictionary *parametes = @{
                                           
                                            @"ios" : @"1",
                                            @"ct" :  @"app",
                                            @"ac" : @"renwu",
                                            @"uid" :uidStr,
                                            @"t" : tStr,
                                            @"sign" : singMD5,
                                         
                                            };
            
           [HWWebUtils doGetWithParameters:parametes progress:nil success:^(id response) {
                
              
                
                
                NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
                
                if ([codeStr intValue] == 1) {
                    
                   // [MBProgressHUD showSuccess:response[@"message"]];
                    
                    self.shujuArr = response[@"data"];
                    
                    NSString *jifen = [NSString stringWithFormat:@"我的积分：%@",response[@"message"]];
                    CGSize size =  [WMUtil strName:jifen fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
                    self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:jifen withRangText:response[@"message"] withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
                    self.jifenLabel.frame = CGRectMake(12, 0, size.width, 40);
                    self.shuaxingBut.frame =    CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
                    self.jifenshituLabel.text = [NSString stringWithFormat:@"%@",response[@"message"]];
                
                    [self.mainaTableVie reloadData];
                    
                    
         
                } else  {
                    
                     [MBProgressHUD showError:response[@"message"]];
                    
                }
             
                
                
            } failure:^(NSString *error) {
                [MBProgressHUD showError:@"兑换失败"];
                
                
            }];
         
      
    
    
}






- (void)shezhichangyongdeshuxiing {
    
    self.icoArr = @[@"welfare_signin",@"welfare_new",@"welfare_message",@"welfare_game",@"welfare_share"];
    self.dataArr = @[@"每日签到",@"新手任务",@"每日任务",@"游戏评论",@"邀请好友"];
    
    self.biaotiArr = @[@"签到得积分，连续签到积分翻倍哦！",@"完成新手任务，送海量积分哦！",@"每天福利等您享，积分送不停！",@"优质的评论信息可以获得积分奖励哦！",@"独乐乐不如众乐乐，快去邀请好友吧！"];
    
    // 重置密码
    
    
}


- (void)setupUI {
   
    self.view.backgroundColor = [UIColor whiteColor];
    self.view.backgroundColor = RGB(242, 242, 242);
    [self setUPbeijingView];
    
    [self navigaView];
    
    self.mainaTableVie.layer.cornerRadius = 3;
    self.mainaTableVie.layer.masksToBounds = YES;
    self.mainaTableVie.scrollEnabled = NO;
    [self.view addSubview:self.mainaTableVie];
    
    
    
}


- (void)setUPbeijingView {
    
    UIView *beijingView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 138+CF_StatusBarHeight)];
    beijingView.backgroundColor = RGB(242, 242, 242);
    beijingView.backgroundColor =  [UIColor bm_colorGradientChangeWithSize:CGSizeMake(kScreenW, 138+CF_StatusBarHeight) direction:IHGradientChangeDirectionVertical startColor:RGB(73, 74, 86) endColor:RGB(32, 32, 42)];
    
    [self.view addSubview:beijingView];
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 165+CF_StatusBarHeight)];
 //    imageView.image = [UIImage imageNamed:@"welfare_bg"];
    imageView.backgroundColor = [UIColor redColor];
    imageView.hidden = YES;
    [beijingView addSubview:imageView];
    
    
    UIImageView *jingxiang = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenW-149-10, 165+CF_StatusBarHeight-124-5, 149, 124)];
    // jingxiang.image = [UIImage imageNamed:@"welfare_con"];
   // jingxiang.backgroundColor = [UIColor yellowColor];
    jingxiang.hidden = YES;
    [imageView addSubview:jingxiang];
    
    
    UIImageView *renwujifenwenziimageview = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenW-147*CFLScaleValue-149-10)/2, 165+CF_StatusBarHeight-50*CFLScaleValue-40, 147*CFLScaleValue, 50*CFLScaleValue)];
    renwujifenwenziimageview.image = [UIImage imageNamed:@"welfare_message_tit"];
   // renwujifenwenziimageview.backgroundColor = [UIColor redColor];
    [imageView addSubview:renwujifenwenziimageview];
    
    
    NSString *wodejifen = [HWjianzhiduiObject keylocalization:@"我的积分"];
    
    
    UIButton *jifenbutt = [UIButton  createButtonWithTitle:wodejifen Image:@"zongjifenico" Target:nil Selector:nil];
    jifenbutt.frame = CGRectMake(20, CF_StatusBarHeight+44+20, 80, 16);
    jifenbutt.backgroundColor = [UIColor clearColor];
    [jifenbutt layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft imageTitleSpace:10];
    [self.view   addSubview:jifenbutt];
    
    self.jifenshituLabel  = [[UILabel alloc]initWithFrame:CGRectMake(42, jifenbutt.bottom+6, 300, 32)];
    self.jifenshituLabel.text = @"";
    self.jifenshituLabel.font = [UIFont systemFontOfSize:20];
    self.jifenshituLabel.textColor = RGB(255, 255, 255);
    [self.view addSubview: self.jifenshituLabel];
    
    
    UIButton *fanhuiBut = [UIButton buttonWithType:UIButtonTypeCustom];
     fanhuiBut.frame = CGRectMake(kScreenW-20-66, CF_StatusBarHeight+44+45 , 66, 26);
     fanhuiBut.backgroundColor = [UIColor  clearColor];
    //  [fanhuiBut setImage:[UIImage imageNamed:@"fanhuijiemianIco"] forState:UIControlStateNormal];
     [fanhuiBut addTarget:self action:@selector(jifenshang) forControlEvents:UIControlEventTouchUpInside];
    
    NSString *sahnchuwodejifen = [HWjianzhiduiObject keylocalization:@"积分商城"];
    [fanhuiBut setTitle:sahnchuwodejifen forState:UIControlStateNormal];
    [fanhuiBut  setTitleColor:RGB(255, 255, 255) forState:UIControlStateNormal];
    fanhuiBut.layer.cornerRadius = 13;
    fanhuiBut.layer.masksToBounds = YES;
    fanhuiBut.titleLabel.font = [UIFont  systemFontOfSize:13];
    fanhuiBut.backgroundColor =  [UIColor bm_colorGradientChangeWithSize:CGSizeMake(66, 26) direction:IHGradientChangeDirectionLevel startColor:RGB(255, 182, 10) endColor:RGB(246, 106, 5)];
    [self.view addSubview:fanhuiBut];
    
    
    
    UIButton *choujiangBut = [UIButton buttonWithType:UIButtonTypeCustom];
     choujiangBut.frame = CGRectMake(kScreenW-20-66-12-66, CF_StatusBarHeight+44+45 , 66, 26);
     choujiangBut.backgroundColor = [UIColor  clearColor];
    //  [fanhuiBut setImage:[UIImage imageNamed:@"fanhuijiemianIco"] forState:UIControlStateNormal];
     [choujiangBut addTarget:self action:@selector(choujiangBut) forControlEvents:UIControlEventTouchUpInside];
    [choujiangBut setTitle:@"积分抽奖" forState:UIControlStateNormal];
    NSString *chojianguwodejifen = [HWjianzhiduiObject keylocalization:@"积分抽奖"];
    [choujiangBut setTitle:chojianguwodejifen forState:UIControlStateNormal];
    
    
    
    [choujiangBut  setTitleColor:RGB(255, 255, 255) forState:UIControlStateNormal];
    choujiangBut.layer.cornerRadius = 13;
    choujiangBut.layer.masksToBounds = YES;
    choujiangBut.titleLabel.font = [UIFont  systemFontOfSize:13];
    choujiangBut.backgroundColor =  [UIColor bm_colorGradientChangeWithSize:CGSizeMake(66, 26) direction:IHGradientChangeDirectionLevel startColor:RGB(255, 182, 10) endColor:RGB(246, 106, 5)];
    [self.view addSubview:choujiangBut];
    
    
    
    
    

    
    
    
   
    
    
    
    
    
    UIView *jifenView = [[UIView alloc]initWithFrame:CGRectMake(15, 165+CF_StatusBarHeight+20-40, kScreenW-15*2, 40)];
   jifenView.backgroundColor = [UIColor whiteColor];
    jifenView.layer.cornerRadius = 6;
    jifenView.layer.masksToBounds = YES;
    jifenView.hidden = YES;
    [beijingView addSubview:jifenView];
    
    UIButton *jifengbuton =  [UIButton buttonWithType:UIButtonTypeCustom];
    [jifengbuton setTitle:@"积分商城" forState:UIControlStateNormal];
    jifengbuton.frame = CGRectMake( kScreenW-15*2-73-15, 8, 73, 25);
    jifengbuton.layer.cornerRadius = 12;
    jifengbuton.layer.masksToBounds = YES;
    jifengbuton.backgroundColor = RGB(233, 241, 255);
    jifengbuton.titleLabel.font = [UIFont systemFontOfSize:12];
    [jifengbuton setTitleColor:RGB(26, 113, 255) forState:UIControlStateNormal];
    [jifengbuton addTarget:self action:@selector(jifengbutonTap) forControlEvents:UIControlEventTouchUpInside];
    
    [jifenView addSubview:jifengbuton];
    
  
    
    
    CGSize size =  [WMUtil strName:@"我的积分：500" fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
    self.jifenLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, 0, size.width, 40)];
    self.jifenLabel.text = @"我的积分：500";
    self.jifenLabel.font = [UIFont systemFontOfSize:14];
    self.jifenLabel.textColor = RGB(51, 51, 51);
    [jifenView addSubview:   self.jifenLabel];

     self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:@"我的积分：500" withRangText:@"500" withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
   
    
    UIButton *shulianbuton =  [UIButton buttonWithType:UIButtonTypeCustom];
    shulianbuton.frame = CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
    [shulianbuton setImage:[UIImage imageNamed:@"welfare_refresh"] forState:UIControlStateNormal];
    self.shuaxingBut = shulianbuton;
    [shulianbuton addTarget:self action:@selector(shuxingBut) forControlEvents:UIControlEventTouchUpInside];
    
    [jifenView addSubview:shulianbuton];
    
    
    
}

#pragma mark -------   点击积分商城
- (void)jifengbutonTap {
    
    
    DLog(@"积分商城")
    
    HWIntegralMallViewController *IntegralMall = [[HWIntegralMallViewController alloc]init];
    [self.navigationController pushViewController:IntegralMall animated:YES];

    
   
    
    
}

- (void)shuxingBut {
    
    
    DLog(@" shuxingBut");
    
    [self fasongwangluoqing];
    
}


- (void)navigaView  {
   
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(10,StatusBarHeight+17, 40, 17);
   // button.backgroundColor = [UIColor redColor];
    [button setImage:[UIImage imageNamed:@"details_back"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonTap) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    UILabel *textlabel = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW-70)/2, StatusBarHeight+17, 70, 17)];
    textlabel.text = @"积分任务";
    
    textlabel.text = [HWjianzhiduiObject keylocalization:@"积分任务"];
    
    
    
    textlabel.textAlignment =  NSTextAlignmentCenter;
    textlabel.textColor = [UIColor whiteColor];
    textlabel.font = [UIFont systemFontOfSize:16];
    [self.view addSubview:textlabel];
    
    
    
    
    NSString *jifenmingxi = [HWjianzhiduiObject keylocalization:@"积分明细"];
    
    
    UILabel *jifenmingxitextlabel = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW-70)-20, StatusBarHeight+17, 70, 17)];
    jifenmingxitextlabel.text = @"积分明细";
    jifenmingxitextlabel.text = jifenmingxi;
    jifenmingxitextlabel.userInteractionEnabled = YES;
    jifenmingxitextlabel.textAlignment =  NSTextAlignmentCenter;
    jifenmingxitextlabel.textColor = [UIColor whiteColor];
       jifenmingxitextlabel.font = [UIFont systemFontOfSize:14];
       [self.view addSubview:jifenmingxitextlabel];
    
    UITapGestureRecognizer *jifentap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(jifenmingxitextlabelTap)];
    
    [jifenmingxitextlabel addGestureRecognizer:jifentap];
    
    
    
       
       
    
    
    
    
    
  //  jiludushao
    
       UIButton *lishijilubutton = [UIButton buttonWithType:UIButtonTypeCustom];
       lishijilubutton.frame = CGRectMake(kScreenW-35,StatusBarHeight+17, 17, 17);
      // button.backgroundColor = [UIColor redColor];
       lishijilubutton.hidden = YES;
       [lishijilubutton setImage:[UIImage imageNamed:@"jiludushao"] forState:UIControlStateNormal];
       [lishijilubutton addTarget:self action:@selector(jiludushaoTap) forControlEvents:UIControlEventTouchUpInside];
       [self.view addSubview:lishijilubutton];
    

}


- (void)jifenmingxitextlabelTap {
    
    HWIntegralSubsidiaryViewController *infee = [[HWIntegralSubsidiaryViewController alloc]init];
    [self.navigationController pushViewController:infee animated:YES];
    
    
}




- (void)buttonTap {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)jiludushaoTap {
    DLog(@"记录");

    
  
    
}




- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
   // [self.navigationController setNavigationBarHidden:YES animated:animated];
    [self.navigationController setNavigationBarHidden:YES];
    [self fasongwangluoqing];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    [self.navigationController setNavigationBarHidden:NO];
    
    
}


#pragma  mark -------- UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    
    return self.shujuArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//    static NSString *cellID = @"cellID";
//
//    HWRenwupingluoTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//
//
//    if (!cell) {
//        cell =   [[NSBundle mainBundle]loadNibNamed:@"HWRenwupingluoTableViewCell" owner:nil options:nil].firstObject;
//
//    }
//   // cell.textLabel.text = @"111";
//
//  //  cell.icoiamgeView.image = [UIImage imageNamed:self.icoArr[indexPath.row]];
//    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
//    cell.backgroundColor = [UIColor whiteColor];
//    cell.backgroundColor =  RGB(247, 247, 247);
////    NSString *icostr = self.icoArr[indexPath.row];
////    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
////
////    cell.icoiamgeView.image = [UIImage imageNamed:icostr];
////    cell.mianshuLabel.text = self.dataArr[indexPath.row];
////    cell.jiehsoLabel.text = self.biaotiArr[indexPath.row];
//    NSDictionary *dic = self.shujuArr[indexPath.row];
//    [cell.icoiamgeView sd_setImageWithURL:[NSURL URLWithString:dic[@"icon"]] placeholderImage:nil];
//    cell.mianshuLabel.text = [NSString stringWithFormat:@"%@",dic[@"name"]];
//    cell.jiehsoLabel.text = [NSString stringWithFormat:@"%@",dic[@"summary"]];
//
//
    
 //  HWjifenRenwuTableViewCell
    
    
      static NSString *cellID = @"cellID";
        
        HWjifenRenwuTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellID];

        
        if (!cell) {
            cell =   [[NSBundle mainBundle]loadNibNamed:@"HWjifenRenwuTableViewCell" owner:nil options:nil].firstObject;
            
        }
       // cell.textLabel.text = @"111";
        
      //  cell.icoiamgeView.image = [UIImage imageNamed:self.icoArr[indexPath.row]];
        cell.selectionStyle =  UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        cell.backgroundColor =  RGB(247, 247, 247);
    //    NSString *icostr = self.icoArr[indexPath.row];
    //    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
    //
    //    cell.icoiamgeView.image = [UIImage imageNamed:icostr];
    //    cell.mianshuLabel.text = self.dataArr[indexPath.row];
    //    cell.jiehsoLabel.text = self.biaotiArr[indexPath.row];
        NSDictionary *dic = self.shujuArr[indexPath.row];
        [cell.tupianImageView sd_setImageWithURL:[NSURL URLWithString:dic[@"icon"]] placeholderImage:nil];
        cell.mwiriqianlabel.text = [NSString stringWithFormat:@"%@",dic[@"name"]];
        cell.xiabianLabel.text = [NSString stringWithFormat:@"%@",dic[@"summary"]];
    
    NSString *type = [NSString stringWithFormat:@"%@",dic[@"type"]];
    
    if ([type intValue] == 0) {
        cell.chaijijifenkaLabel.hidden = YES;
        
        cell.chaijijifenkaLabel.text = @"VIP会员积分翻倍";
        
    } else if ([type intValue] == 2 ) {
        
         cell.chaijijifenkaLabel.hidden = YES;
         cell.chaijijifenkaLabel.text = @"实名认证有好礼";
        
    } else {
        
         cell.chaijijifenkaLabel.hidden = YES;
        
    }
    
     
    
  
       return  cell;
    
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    return 70; 
    return  58;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
    NSDictionary *dic = self.shujuArr[indexPath.row];
    NSString *nameStr =  [NSString stringWithFormat:@"%@",dic[@"name"]];
    
    NSString *type =  [NSString stringWithFormat:@"%@",dic[@"type"]];
    
    
    if ([type isEqualToString:@"0"]) {
        
//        HWDailyCheckController *dail = [[HWDailyCheckController alloc]init];
//        [self.navigationController pushViewController:dail animated:YES];
//
        HWNewSignInViewController *sign = [[HWNewSignInViewController alloc]init];
        [self.navigationController pushViewController:sign animated:YES];
        
        
        
        
    }else if ([type isEqualToString:@"2"]) {
        
        
        HWzuixingdemeirienwuViewController *meiti = [[HWzuixingdemeirienwuViewController alloc]init];
        [self.navigationController pushViewController:meiti animated:YES];
        
        
    }else if ([type isEqualToString:@"1"]) {
        
        HWzjuixingshourenwuViewController *xingshou = [[HWzjuixingshourenwuViewController alloc]init];
        [self.navigationController pushViewController:xingshou animated:YES];
        
        
    }else if ([type isEqualToString:@"4"]) {
        
//        HWInviteFriendsViewController *inviteFriends = [[HWInviteFriendsViewController alloc]init];
//          [self.navigationController pushViewController:inviteFriends animated:YES];
//
        
        HWyaoqinghaoyoujiemianViewController *yaoqing  = [[HWyaoqinghaoyoujiemianViewController alloc]init];
        [self.navigationController pushViewController:yaoqing animated:YES];

        
        
       
       
        
    }else if ([type isEqualToString:@"110"]) {
        
        
        
    }
    
    
    return;
    
    
    
    if ([nameStr isEqualToString:@"每日签到"]) {
        
        HWDailyCheckController *dail = [[HWDailyCheckController alloc]init];
        [self.navigationController pushViewController:dail animated:YES];
        
        
    } else if ([nameStr isEqualToString:@"新手任务"] ) {
        
        HWzjuixingshourenwuViewController *xingshou = [[HWzjuixingshourenwuViewController alloc]init];
        [self.navigationController pushViewController:xingshou animated:YES];
        
        
        
       //  [MBProgressHUD showError:@"此功能暂未开放"];
        return;
        
//        HWXingshouRenwuViewController *xingshou =   [[HWXingshouRenwuViewController alloc]init];
//       [self.navigationController pushViewController:xingshou animated:YES];
        
    } else if ([nameStr isEqualToString:@"每日任务"] ) {
        
        HWzuixingdemeirienwuViewController *meiti = [[HWzuixingdemeirienwuViewController alloc]init];
        [self.navigationController pushViewController:meiti animated:YES];
        
        
        
//        [MBProgressHUD showError:@"此功能暂未开放"];
//              return;
//        HWMeiRiRenWuViewController *meiriRenWu = [[HWMeiRiRenWuViewController alloc]init];
//         [self.navigationController pushViewController:meiriRenWu animated:YES];

        
    }else if ([nameStr isEqualToString:@"游戏评论"] ) {
        
        [MBProgressHUD showError:@"此功能暂未开放"];
        return;
              
        
    }else if ([nameStr isEqualToString:@"邀请好友"] ) {
//        [MBProgressHUD showError:@"此功能暂未开放"];
//              return;
         HWInviteFriendsViewController *inviteFriends = [[HWInviteFriendsViewController alloc]init];
           [self.navigationController pushViewController:inviteFriends animated:YES];
        
    }
    
    
//    if (indexPath.row == 0 ) {
//
//
//    } else if (indexPath.row == 1) {
//
//        HWXingshouRenwuViewController *xingshou =   [[HWXingshouRenwuViewController alloc]init];
//        [self.navigationController pushViewController:xingshou animated:YES];
//
//
//
//    } else if (indexPath.row == 2) {
//
//        HWMeiRiRenWuViewController *meiriRenWu = [[HWMeiRiRenWuViewController alloc]init];
//        [self.navigationController pushViewController:meiriRenWu animated:YES];
//
//    } else if (indexPath.row == 3) {
//
//
//
//    } else if (indexPath.row == 4) {
//
//        HWInviteFriendsViewController *inviteFriends = [[HWInviteFriendsViewController alloc]init];
//        [self.navigationController pushViewController:inviteFriends animated:YES];
//
//
//    }
//
//
    
}



- (void)jifenshang {
    
    NSLog(@"积分商场");
//    HWIntegralMallViewController *ingta = [[HWIntegralMallViewController alloc]init];
//    [self.navigationController pushViewController:ingta animated:YES];
//
    
    
    HWIntegralMallshopViewController *shop = [[HWIntegralMallshopViewController alloc]init];
    [self.navigationController pushViewController:shop animated:YES];
    

}


// cho
- (void)choujiangBut {
    
    //http://star.94php.com/?ct=choujiang&token=cC0PWoJSpHkFEPvAR2Lh_DaadCzWCXHcJ_blEBRIoqXyBaXAGuEOB3EuE1ALhA9i&t=1611035723&sign=1fa36d55ef6b6695a7654d99f8e33a1c
    
    
    NSString *uid = [HWLocallyStoredData getLoginUserID];
                int t =   [WMUtil  getRandomNumber:101 to:998];
                NSString *tString = [NSString stringWithFormat:@"%ld%d",[WMUtil getTimeSp],t];
            
              //  NSString *gidStr = [NSString stringWithFormat:@"%@",self.gameId];
                NSString *signStr = [NSString stringWithFormat:@"%@%@%@",uid,tString,@"fsd213ewdsadqwe2121213edsad"];
                NSString *signMD5 = [WMUtil md5HexDigest:signStr];

           
           NSString *urlStr = [NSString stringWithFormat:@"%@?ct=choujiang&uid=%@&t=%@&sign=%@&language=%@",[HWOCGlobalConst baseUrl],uid,tString,signMD5,[HWjianzhiduiObject returnLanguageAcquisition]];
        XMGWebViewController *webVc = [[XMGWebViewController alloc] init];
        webVc.url = [NSURL URLWithString:urlStr];
       [self.navigationController pushViewController:webVc animated:YES];
         
    
    
}






@end



#pragma mark ------------ 以前代码


//#import "HWTaskCenterViewController.h"
//#import "HWRenwupingluoTableViewCell.h"
//#import "HWIntegralMallViewController.h" // 积分商城
//#import "HWXingshouRenwuViewController.h" // 新手任务
//#import "HWMeiRiRenWuViewController.h"  // 每日任务
//#import "HWInviteFriendsViewController.h" //邀请好友
//#import "HWDailyCheckController.h"  // 每日签到
//
//
//
//
//@interface HWTaskCenterViewController ()<UITableViewDelegate,UITableViewDataSource>
//@property(strong,nonatomic) UITableView *mainaTableVie;
//@property(strong,nonatomic) NSArray *dataArr;
//@property(strong,nonatomic) NSArray *biaotiArr;
//@property(strong,nonatomic) NSArray *icoArr;
//@property(strong,nonatomic) UILabel *jifenLabel; //积分Label
//@property(strong,nonatomic) NSArray *shujuArr;
//@property(strong,nonatomic) UIButton *shuaxingBut;
//
//
//
//
//@end
//
//@implementation HWTaskCenterViewController
//
//
//-(UITableView *)mainaTableVie {
//
//    if (_mainaTableVie == nil
//        ) {
//        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(15, 165+CF_StatusBarHeight+20+8, kScreenW-30,58*5) style:UITableViewStylePlain];
//         _mainaTableVie.delegate = self;
//         _mainaTableVie.dataSource = self;
//        _mainaTableVie.backgroundColor = [UIColor whiteColor];
//        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
//
//    }
//    return   _mainaTableVie ;
//}
//
//
//- (void)viewDidLoad {
//    [super viewDidLoad];
//    // Do any additional setup after loading the view.
//
//    [self shezhichangyongdeshuxiing];
//
//    [self setupUI];
//
//    [self fasongwangluoqing];
//}
//
//
//- (void)fasongwangluoqing {
//
//
//
//       //重制密码
//
//        int  r =  [WMUtil getRandomNumber:101 to:998];
//
//
//         NSString *uidStr = [NSString stringWithFormat:@"%@",[HWLocallyStoredData getLoginUserID]];
//         NSString *tStr = [NSString stringWithFormat:@"%ld%d",[WMUtil getTimeSp],r];
//
//
//
//         NSString *singStr = [NSString stringWithFormat:@"%@%@%@",uidStr,tStr,@"fsd213ewdsadqwe2121213edsad"];
//
//         NSString *singMD5 = [WMUtil md5HexDigest:singStr];
//
//
//         NSDictionary *parametes = @{
//
//                                            @"ios" : @"1",
//                                            @"ct" :  @"app",
//                                            @"ac" : @"renwu",
//                                            @"uid" :uidStr,
//                                            @"t" : tStr,
//                                            @"sign" : singMD5,
//
//                                            };
//
//           [HWWebUtils doGetWithParameters:parametes progress:nil success:^(id response) {
//
//
//
//
//                NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
//
//                if ([codeStr intValue] == 1) {
//
//                   // [MBProgressHUD showSuccess:response[@"message"]];
//
//                    self.shujuArr = response[@"data"];
//
//                    NSString *jifen = [NSString stringWithFormat:@"我的积分：%@",response[@"message"]];
//                    CGSize size =  [WMUtil strName:jifen fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
//                    self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:jifen withRangText:response[@"message"] withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
//                    self.jifenLabel.frame = CGRectMake(12, 0, size.width, 40);
//                    self.shuaxingBut.frame =    CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
//
//                    [self.mainaTableVie reloadData];
//
//
//
//                } else  {
//
//                     [MBProgressHUD showError:response[@"message"]];
//
//                }
//
//
//
//            } failure:^(NSString *error) {
//                [MBProgressHUD showError:@"兑换失败"];
//
//
//            }];
//
//
//
//
//}
//
//
//
//
//
//
//- (void)shezhichangyongdeshuxiing {
//
//    self.icoArr = @[@"welfare_signin",@"welfare_new",@"welfare_message",@"welfare_game",@"welfare_share"];
//    self.dataArr = @[@"每日签到",@"新手任务",@"每日任务",@"游戏评论",@"邀请好友"];
//
//    self.biaotiArr = @[@"签到得积分，连续签到积分翻倍哦！",@"完成新手任务，送海量积分哦！",@"每天福利等您享，积分送不停！",@"优质的评论信息可以获得积分奖励哦！",@"独乐乐不如众乐乐，快去邀请好友吧！"];
//
//    // 重置密码
//
//
//}
//
//
//- (void)setupUI {
//
//    self.view.backgroundColor = [UIColor whiteColor];
//    self.view.backgroundColor = RGB(242, 242, 242);
//    [self setUPbeijingView];
//
//    [self navigaView];
//
//    self.mainaTableVie.layer.cornerRadius = 3;
//    self.mainaTableVie.layer.masksToBounds = YES;
//    self.mainaTableVie.scrollEnabled = NO;
//    [self.view addSubview:self.mainaTableVie];
//
//
//
//}
//
//
//- (void)setUPbeijingView {
//
//    UIView *beijingView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 165+CF_StatusBarHeight+20)];
//    beijingView.backgroundColor = RGB(242, 242, 242);
//
//    [self.view addSubview:beijingView];
//
//    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 165+CF_StatusBarHeight)];
//    imageView.image = [UIImage imageNamed:@"welfare_bg"];
//    [beijingView addSubview:imageView];
//
//
//    UIImageView *jingxiang = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenW-149-10, 165+CF_StatusBarHeight-124-5, 149, 124)];
//    jingxiang.image = [UIImage imageNamed:@"welfare_con"];
//   // jingxiang.backgroundColor = [UIColor yellowColor];
//
//    [imageView addSubview:jingxiang];
//
//
//    UIImageView *renwujifenwenziimageview = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenW-147*CFLScaleValue-149-10)/2, 165+CF_StatusBarHeight-50*CFLScaleValue-40, 147*CFLScaleValue, 50*CFLScaleValue)];
//    renwujifenwenziimageview.image = [UIImage imageNamed:@"welfare_message_tit"];
//   // renwujifenwenziimageview.backgroundColor = [UIColor redColor];
//    [imageView addSubview:renwujifenwenziimageview];
//
//
//
//    UIView *jifenView = [[UIView alloc]initWithFrame:CGRectMake(15, 165+CF_StatusBarHeight+20-40, kScreenW-15*2, 40)];
//   jifenView.backgroundColor = [UIColor whiteColor];
//    jifenView.layer.cornerRadius = 6;
//    jifenView.layer.masksToBounds = YES;
//
//    [beijingView addSubview:jifenView];
//
//    UIButton *jifengbuton =  [UIButton buttonWithType:UIButtonTypeCustom];
//    [jifengbuton setTitle:@"积分商城" forState:UIControlStateNormal];
//    jifengbuton.frame = CGRectMake( kScreenW-15*2-73-15, 8, 73, 25);
//    jifengbuton.layer.cornerRadius = 12;
//    jifengbuton.layer.masksToBounds = YES;
//    jifengbuton.backgroundColor = RGB(233, 241, 255);
//    jifengbuton.titleLabel.font = [UIFont systemFontOfSize:12];
//    [jifengbuton setTitleColor:RGB(26, 113, 255) forState:UIControlStateNormal];
//    [jifengbuton addTarget:self action:@selector(jifengbutonTap) forControlEvents:UIControlEventTouchUpInside];
//
//    [jifenView addSubview:jifengbuton];
//
//
//
//
//    CGSize size =  [WMUtil strName:@"我的积分：500" fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
//    self.jifenLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, 0, size.width, 40)];
//    self.jifenLabel.text = @"我的积分：500";
//    self.jifenLabel.font = [UIFont systemFontOfSize:14];
//    self.jifenLabel.textColor = RGB(51, 51, 51);
//    [jifenView addSubview:   self.jifenLabel];
//
//     self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:@"我的积分：500" withRangText:@"500" withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
//
//
//    UIButton *shulianbuton =  [UIButton buttonWithType:UIButtonTypeCustom];
//    shulianbuton.frame = CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
//    [shulianbuton setImage:[UIImage imageNamed:@"welfare_refresh"] forState:UIControlStateNormal];
//    self.shuaxingBut = shulianbuton;
//    [shulianbuton addTarget:self action:@selector(shuxingBut) forControlEvents:UIControlEventTouchUpInside];
//
//    [jifenView addSubview:shulianbuton];
//
//}
//
//#pragma mark -------   点击积分商城
//- (void)jifengbutonTap {
//
//
//    DLog(@"积分商城")
//
//    HWIntegralMallViewController *IntegralMall = [[HWIntegralMallViewController alloc]init];
//    [self.navigationController pushViewController:IntegralMall animated:YES];
//
//
//
//}
//
//- (void)shuxingBut {
//
//
//    DLog(@" shuxingBut");
//
//    [self fasongwangluoqing];
//
//}
//
//
//- (void)navigaView  {
//
//    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
//    button.frame = CGRectMake(10,StatusBarHeight+17, 40, 17);
//   // button.backgroundColor = [UIColor redColor];
//    [button setImage:[UIImage imageNamed:@"details_back"] forState:UIControlStateNormal];
//    [button addTarget:self action:@selector(buttonTap) forControlEvents:UIControlEventTouchUpInside];
//
//    [self.view addSubview:button];
//
//    UILabel *textlabel = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW-70)/2, StatusBarHeight+17, 70, 17)];
//    textlabel.text = @"任务中心";
//    textlabel.textAlignment =  NSTextAlignmentCenter;
//    textlabel.textColor = [UIColor whiteColor];
//    textlabel.font = [UIFont systemFontOfSize:16];
//    [self.view addSubview:textlabel];
//
//
//
//
//
//  //  jiludushao
//
//       UIButton *lishijilubutton = [UIButton buttonWithType:UIButtonTypeCustom];
//       lishijilubutton.frame = CGRectMake(kScreenW-35,StatusBarHeight+17, 17, 17);
//      // button.backgroundColor = [UIColor redColor];
//       [lishijilubutton setImage:[UIImage imageNamed:@"jiludushao"] forState:UIControlStateNormal];
//       [lishijilubutton addTarget:self action:@selector(jiludushaoTap) forControlEvents:UIControlEventTouchUpInside];
//       [self.view addSubview:lishijilubutton];
//
//
//
//}
//
//
//
//
//- (void)buttonTap {
//
//    [self.navigationController popViewControllerAnimated:YES];
//}
//- (void)jiludushaoTap {
//    DLog(@"记录");
//
//
//
//
//}
//
//
//
//
//- (void)viewWillAppear:(BOOL)animated {
//    [super viewWillAppear:animated];
//
//   // [self.navigationController setNavigationBarHidden:YES animated:animated];
//    [self.navigationController setNavigationBarHidden:YES];
//}
//
//- (void)viewWillDisappear:(BOOL)animated {
//    [super viewWillDisappear:animated];
//
//    [self.navigationController setNavigationBarHidden:NO];
//
//
//}
//
//
//#pragma  mark -------- UITableViewDelegate
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//
//
//    return self.shujuArr.count;
//}
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//    static NSString *cellID = @"cellID";
//
//    HWRenwupingluoTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//
//
//    if (!cell) {
//        cell =   [[NSBundle mainBundle]loadNibNamed:@"HWRenwupingluoTableViewCell" owner:nil options:nil].firstObject;
//
//    }
//   // cell.textLabel.text = @"111";
//
//  //  cell.icoiamgeView.image = [UIImage imageNamed:self.icoArr[indexPath.row]];
//    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
//    cell.backgroundColor = [UIColor whiteColor];
//
////    NSString *icostr = self.icoArr[indexPath.row];
////    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
////
////    cell.icoiamgeView.image = [UIImage imageNamed:icostr];
////    cell.mianshuLabel.text = self.dataArr[indexPath.row];
////    cell.jiehsoLabel.text = self.biaotiArr[indexPath.row];
//    NSDictionary *dic = self.shujuArr[indexPath.row];
//    [cell.icoiamgeView sd_setImageWithURL:[NSURL URLWithString:dic[@"icon"]] placeholderImage:nil];
//    cell.mianshuLabel.text = [NSString stringWithFormat:@"%@",dic[@"name"]];
//    cell.jiehsoLabel.text = [NSString stringWithFormat:@"%@",dic[@"summary"]];
//
//    return  cell;
//
//
//
//}
//
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
//
//
//
//    return  58;
//}
//
//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//
//
//
//    NSDictionary *dic = self.shujuArr[indexPath.row];
//    NSString *nameStr =  [NSString stringWithFormat:@"%@",dic[@"name"]];
//
//
//    if ([nameStr isEqualToString:@"每日签到"]) {
//
//        HWDailyCheckController *dail = [[HWDailyCheckController alloc]init];
//        [self.navigationController pushViewController:dail animated:YES];
//
//
//    } else if ([nameStr isEqualToString:@"新手任务"] ) {
//
//
//        [MBProgressHUD showError:@"此功能暂未开放"];
//        return;
//
//        HWXingshouRenwuViewController *xingshou =   [[HWXingshouRenwuViewController alloc]init];
//       [self.navigationController pushViewController:xingshou animated:YES];
//
//    } else if ([nameStr isEqualToString:@"每日任务"] ) {
//
//        [MBProgressHUD showError:@"此功能暂未开放"];
//              return;
//        HWMeiRiRenWuViewController *meiriRenWu = [[HWMeiRiRenWuViewController alloc]init];
//         [self.navigationController pushViewController:meiriRenWu animated:YES];
//
//
//    }else if ([nameStr isEqualToString:@"游戏评论"] ) {
//
//        [MBProgressHUD showError:@"此功能暂未开放"];
//        return;
//
//
//    }else if ([nameStr isEqualToString:@"邀请好友"] ) {
////        [MBProgressHUD showError:@"此功能暂未开放"];
////              return;
//         HWInviteFriendsViewController *inviteFriends = [[HWInviteFriendsViewController alloc]init];
//           [self.navigationController pushViewController:inviteFriends animated:YES];
//
//    }
//
//
////    if (indexPath.row == 0 ) {
////
////
////    } else if (indexPath.row == 1) {
////
////        HWXingshouRenwuViewController *xingshou =   [[HWXingshouRenwuViewController alloc]init];
////        [self.navigationController pushViewController:xingshou animated:YES];
////
////
////
////    } else if (indexPath.row == 2) {
////
////        HWMeiRiRenWuViewController *meiriRenWu = [[HWMeiRiRenWuViewController alloc]init];
////        [self.navigationController pushViewController:meiriRenWu animated:YES];
////
////    } else if (indexPath.row == 3) {
////
////
////
////    } else if (indexPath.row == 4) {
////
////        HWInviteFriendsViewController *inviteFriends = [[HWInviteFriendsViewController alloc]init];
////        [self.navigationController pushViewController:inviteFriends animated:YES];
////
////
////    }
////
////
//
//}
//
//
//
//
//
//
//
//@end
//
//
